package jUtil;

import java.util.function.Consumer;
import java.util.function.Function;
import java.util.function.Predicate;
import java.util.function.Supplier;

/**
 * @author ：黄淼淳
 * @date ：2021/12/20 12:47
 * @description：函数式接口
 */
public class Function4Demo {

    private static void supplier() {
        Supplier<String> supplier = ()->{return "李四";};
        System.out.println(supplier.get());
    }

    private static void function() {
        Function<String,Integer> function = t->{
            System.out.println(t);
            return 1024;
        };
        System.out.println(function.apply("张三"));
    }

    private static void consumer() {
        Consumer<String> consumer = t->{
            System.out.println(t);
        };
        consumer.accept("黄淼淳");
    }

    private static void predict() {
        Predicate<Integer> predicate = t->{return true;};
        System.out.println(predicate.test(1024));
    }
}
